home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
PGRAPH.ZIP
/
PGRAPH.PRG
next >
Wrap
Text File
|
1990-11-18
|
14KB
|
441 lines
*************************************************************************
*** Demonstration and Source Code of 'Progress' Graphs ***
*** Courtesy of TJS LAB, Orlando, Florida 32858-5366 (407) 291-3960 ***
*** Compile with Clipper Summer 87 or 5.0 ***
*************************************************************************
fpainth() && 'paint' the main screen
fmakedb() && make a sample database with 50 records or just open database
declare arrtemp[7] && to contain the menu for the various graphs
arrtemp[1]="Standard Sliding Bar Along a Line"
arrtemp[2]="Standard Sliding Bar Within A Box"
arrtemp[3]="Vertical Bar (Thermometer)"
arrtemp[4]="Exploding Boxes"
arrtemp[5]="Multiple Boxes"
arrtemp[6]="Hour Glass"
arrtemp[7]="Demo ALL!"
opt=1 && initial selection choice
set cursor off
do while .t.
opt=achoice(8, 36, 13, 77, arrtemp,.T.,"",opt,0)
do case && determine which graph to display
case opt=1
report1() && Standard Sliding Bar Along a Line
case opt=2
report2() && Standard Sliding Bar Within a Box
case opt=3
report3() && Vertical Bar (Thermometer)
case opt=4
report4() && Exploding Boxes
case opt=5
report5() && Multiple Boxes
case opt=6
report6() && Hour Glass
case opt=7
report7() && Demo All
case opt=0
exit && Exit Program
endcase
keyboard chr(24) && move down to next menu option...
set color to W+/N
enddo
set cursor on
set color to W/N
@ 24,0
?
return
function fpainth && 'paint' the main screen for this program
set color to B+/N
clear
@ 1,0 to 23,79 double
@ 23,60 say "[ TJS LAB ]"
set color to W+/R
@ 1,23 say "[ PROGRESS GRAPH DEMONSTRATION ]"
set color to BG+/N
@ 3,5 say "The purpose of this program is to demonstrate the use of 'Progress'"
@ 4,5 say "graphs on the screen during program execution."
@ 5,5 say "Progress graphs tend to make programs execute slightly slower, but"
@ 6,5 say "the effect of 'bells & whistles' sometimes outweighs time..."
set color to GR+/N
@ 8,5 say "This program demonstrates the use of a variety of progress graphs"
@ 9,5 say "while it 'looks at' all records in a sample database."
@ 10,5 say "You can use the progress graph in conjunction with many operations,"
@ 11,5 say "ie, reports, counting, summing, or updating data..."
set color to G+/N
@ 13,5 say "This program is released into Public Domain. No Copyright!"
set color to W+/N
@ 15,5 say "If you use any part of this source, please (but you do not have to)"
@ 16,5 say "donate $10.00 payable to:"
@ 18,5 say "Orlando Clipper Users Group (O.C.U.G.)"
@ 19,5 say "c/o Tom Rouse, President"
@ 20,5 say "P.O. Box 585366"
@ 21,5 say "Orlando, Florida 32858-5366"
kwait() && pause for 60 seconds or until any key is pressed
set color to B+/N
@ 7,35 clear to 15,78
@ 7,35 to 15,78 double
set color to W+*/B
@ 14,36 say " Select Option! "
set color to W+/N
return ""
function fmakedb && make sample.dbf with 50 records or just open database
if !file("sample.dbf")
create sample.$$$
use sample.$$$ exclusive
append blank
replace field_name with "ITEM"
replace field_type WITH "C"
replace field_len WITH 12
append blank
replace field_name with "DESC"
replace field_type WITH "C"
replace field_len WITH 30
append blank
replace field_name with "QTY"
replace field_type WITH "N"
replace field_len WITH 10
replace field_dec WITH 3
use
create sample from sample.$$$
erase sample.$$$
for i=1 to 50 && make the 50 records...
append blank
replace item with "XXX"+ltrim(str(I))
replace desc with ltrim(str(i))+" - Description"
replace qty with recno()*2.984
next
else
use sample exclusive
endif
return ""
function kwait && pause for 60 seconds...
set color to W+*/N
@ 24,0 say "Press any key to continue..."
keyboard ""
inkey(60)
set color to W/N
@ 24,0 && remove message
return ""
function report1 && Sliding Bar Along a Line
save screen to scrn1
goto top && start at the top of the file...
fslide1() && paint the line graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
@ 23,6 say replicate(chr(219),(ii/lastrec())*68)
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report2 && Sliding Bar Within A Box
save screen to scrn1
goto top && start at the top of the file...
fslide2() && paint the Box graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
@ 4,8 say replicate(chr(219),(ii/lastrec())*66)
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report3 && Vertical Bar/Thermometer
save screen to scrn1
goto top && start at the top of the file...
fthermo(0,"X") && paint the Vertical/Thermo graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
fthermo(ii) && update the Vertical/Thermo graph
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report4 && Exploding Box
save screen to scrn1
goto top && start at the top of the file...
ii=0 && graph counter
set color to W+/B
do while !eof()
ii=ii+1
fexbox(ii,11,65) && exploding box progress graph: counter,row,column
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report5 && Multiple Boxes
save screen to scrn1
goto top && start at the top of the file...
ii=0 && graph counter
fmultibox(9,ii+1,.t.) && paint the graph box...
do while !eof()
ii=ii+1
fmultibox(9,ii,.f.) && update the graph box...
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report6 && Hour Glass
save screen to scrn1
goto top && start at the top of the file...
ii=0 && graph counter
fhglass(ii,"X") && paint the graph box...
set color to W+/N
do while !eof()
ii=ii+1
fhglass(ii) && update the graph box...
inkey(.1) && pause for visual effects....
* Here, you would put your routines that report, count and/or update
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function report7 && Demo ALL!
save screen to scrn1
goto top && start at the top of the file...
fslide1() && paint the line graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
@ 23,6 say replicate(chr(219),(ii/lastrec())*68)
inkey(.1) && pause for visual effects....
skip
enddo
goto top && start at the top of the file...
fslide2() && paint the Box graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
@ 4,8 say replicate(chr(219),(ii/lastrec())*66)
inkey(.1) && pause for visual effects....
skip
enddo
goto top && start at the top of the file...
fthermo(0,"X") && paint the Vertical/Thermo graph onto the screen
ii=0 && graph counter
do while !eof()
ii=ii+1
fthermo(ii) && update the Vertical/Thermo graph
inkey(.1) && pause for visual effects....
skip
enddo
goto top && start at the top of the file...
ii=0 && graph counter
set color to W+/B
do while !eof()
ii=ii+1
fexbox(ii,11,65) && exploding box progress graph: counter,row,column
inkey(.1) && pause for visual effects....
skip
enddo
goto top && start at the top of the file...
ii=0 && graph counter
fmultibox(9,ii+1,.t.) && paint the graph box...
do while !eof()
ii=ii+1
fmultibox(9,ii,.f.) && update the graph box...
inkey(.1) && pause for visual effects....
skip
enddo
goto top && start at the top of the file...
ii=0 && graph counter
fhglass(ii,"X") && paint the graph box...
set color to W+/N
do while !eof()
ii=ii+1
fhglass(ii) && update the graph box...
inkey(.1) && pause for visual effects....
skip
enddo
kwait() && pause for 60 seconds...
restore screen from scrn1
return ""
function fslide1 && Standard Sliding Bar Along A Line
set color to BG+/N
@ 22,6 say "0 50% Finis"
set color to B+/N
@ 23,5 say "╣──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──╠" && 68 wide
set color to BR+/N
return ""
function fslide2 && Standard Sliding Bar Within A Box
set color to B+/N
@ 3,4 say " ╔════════════════╤════════════════╤═══════════════╤════════════════╗"
@ 4,4 say " ╟────────────────┼────────────────┼───────────────┼────────────────╢"
@ 5,4 say "╔══╬════════════════╪════════════════╪═══════════════╪════════════════╬══╗"
@ 6,4 say "║ ║"
@ 7,4 say "╚════════════════════════════════════════════════════════════════════════╝"
set color to BG+/N
@ 6,7 say "0% Completed∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙50%∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙Done!"
set color to BR+/N
return ""
function fthermo && Vertical Bar/Thermometer
parameter parm,parm1
private parm,parm1
if pcount()>1
set color to W+/B
@ 2,71 say "▄▄▄▄▄▄▄▄▄"
@ 3,71 say "║100%┬──╫"
@ 4,71 say "║ . │──║"
@ 5,71 say "║ . │──║"
@ 6,71 say "║ 83%┼──╫"
@ 7,71 say "║ . │──║"
@ 8,71 say "║ . │──║"
@ 9,71 say "║ 67%┼──╫"
@ 10,71 say "║ . │──║"
@ 11,71 say "║ . │──║"
@ 12,71 say "║ 50%┼──╫"
@ 13,71 say "║ . │──║"
@ 14,71 say "║ . │──║"
@ 15,71 say "║ 33%┼──╫"
@ 16,71 say "║ . │──║"
@ 17,71 say "║ . │──║"
@ 18,71 say "║ 17%┼──╫"
@ 19,71 say "║ . │──║"
@ 20,71 say "║ . │──║"
@ 21,71 say "║ 0%┴──╫"
@ 22,71 say "▀▀▀▀▀▀▀▀▀"
endif
set color to R+/N
@ 21-(parm/lastrec())*18,77,21,78 box chr(219)+chr(219)+chr(219)+chr(219)+chr(219)+chr(219)+chr(219)+chr(219)+chr(219)
return ""
function fexbox && exploding box progress graph
parameter parm,parm1,parm2
private parm,parm1,parm2,parm3
parm3=(parm/lastrec()+.0001)*10
@ parm1-int(parm3),parm2-int(parm3) to parm1+2+int(parm3),parm2+3+int(parm3)
@ parm1+1,parm2+1 say parm3*10 picture "99"
* ┌────────────────────┐
* │┌──────────────────┐│
* ││┌────────────────┐││
* │││┌──────────────┐│││
* ││││┌────────────┐││││
* │││││┌──────────┐│││││
* ││││││┌────────┐││││││
* │││││││┌──────┐│││││││
* ││││││││┌────┐││││││││
* │││││││││┌──┐│││││││││
* ││││││││││XX││││││││││
* │││││││││└──┘│││││││││
* ││││││││└────┘││││││││
* │││││││└──────┘│││││││
* ││││││└────────┘││││││
* │││││└──────────┘│││││
* ││││└────────────┘││││
* │││└──────────────┘│││
* ││└────────────────┘││
* │└──────────────────┘│
* └────────────────────┘
RETURN ""
function fmultibox && progress graph in the form of boxes...
parameter parm,parm1,parm2 && parm is the top line... parm1 is the counter
private i,parm,parm1,parm2 && parm2 is the flag to print the 'blank' graph
* ┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐
* │10%││20%││30%││40%││50%││60%││70%││80%││90%││100│
* └───┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘
if parm2
set color to W/N
for i=1 to 10
@ parm, 15+(i-1)*5 to parm+2,19+(i-1)*5
@ parm+1,16+(i-1)*5 say ltrim(str(i*10,3,0))+iif(i=10,"","%")
next
return ""
endif
if ((parm1/lastrec())+.0001)*10 < 1
return ""
endif
for i=int( ((parm1/lastrec())+.0001)*10) to int( ((parm1/lastrec())+.0001)*10)
setcolor("W+/"+substr("B ,R ,G ,RB,GR,BG,G ,RB,R ,B ",1+(I-1)*3,2))
@ parm,15+(i-1)*5 clear to parm+2,19+(i-1)*5
@ parm,15+(i-1)*5 to parm+2,19+(i-1)*5
@ parm+1,16+(i-1)*5 say ltrim(str(i*10,3,0))+iif(i=10,"","%")
next
set color to W+/N
return ""
function fhglass && Hour Glass progress graph
parameter parm,parm1
private parm,parm1
if pcount()>1
set color to B+/N
@ 1,3 clear to 20,26
@ 1,3 to 20,26 double
set color to W+/N
@ 2,7 say "┌──────────────┐"
@ 3,7 say "│ │"
@ 4,7 say "│ │"
@ 5,7 say "│ │"
@ 6,7 say "│ │"
@ 7,7 say "│ │"
@ 8,7 say "└─────╖ ╓─────┘"
@ 9,13 say "║ ║"
@ 10,13 say "║ ║"
@ 11,7 say "┌─────╜ ╙─────┐"
@ 12,7 say "│100% │"
@ 13,7 say "│80% │"
@ 14,7 say "│60% │"
@ 15,7 say "│40% │"
@ 16,7 say "│20% │"
@ 17,6 say "╔╧══════════════╧╗"
@ 18,6 say "║ ║"
@ 19,5 say"═╩════════════════╩═"
set color to N/B
@ 18,7 say " PROGRESS GLASS "
set color to W+/R
@ 3,8 clear to 7,21
endif
x1=int((parm/lastrec())*5.1)
set color to W+/N
@ 3,8 clear to 2+x1,21
for i=8 to 16-x1
@ i,14 say " "
set color to W+/N
@ i,14 say " "
set color to W+/R
next
@ 17-x1,8 clear to 16,21
set color to W+/N
return ""